<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="string" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<%@ taglib uri="/WEB-INF/tlds/pagination.tld" prefix="pagination" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Dayve web</title>
    <link href="/common/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="/common/js/common.js"></script>
    <script type='text/javascript' src="/common/dwr/engine.js"></script>
    <script type='text/javascript' src="/common/dwr/util.js"></script>
    <script type="text/javascript">
        // 페이지 이동을 처리한다.
        function goListPage(page) {
            var TheForm = document.frm;
            TheForm.currentPage.value = page;
            TheForm.nextTarget.value = 'admin';
            TheForm.action = './admin.do';
            TheForm.submit();
        }

        // 검색어로 리스트를 출력한다.
        function jsSearchList() {
            var TheForm = document.frm;
            TheForm.title.value = TheForm.search_title.value;
            TheForm.writer_id.value = TheForm.search_writer.value;
            TheForm.writer_nick_name.value = TheForm.search_nickName.value;
            TheForm.content.value = TheForm.search_content.value;
            TheForm.nextTarget.value = 'communityBoardList';
            TheForm.action = './communityBoardList.do';
            TheForm.submit();
        }

        // 글쓰기 페이지로 이동 : 세션이 존재할 때만 가능
        function jsWriteBoard() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'communityBoardWrite';
            TheForm.action = "./communityBoardWrite.do";
            TheForm.submit();
        }

        // 글수정 페이지로 이동 password 검사 : TheForm 에 Update Page 에 나올 내용을 담아 nextTarget 으로 넘겨준다
        function jsUpdateBoard() {
            var TheForm = document.writeFrm;
            TheForm.nextTarget.value = 'communityBoardUpdate';
            TheForm.action = './communityBoardUpdate.do';
            TheForm.submit();
        }

        // 글 삭제 password 검사 리스트 페이지로 이동
        function jsDeleteBoard() {
            if(confirm("삭제하시겠습니까?")){
                var TheForm = document.writeFrm;
                var now = new Date();                                                  // 현재시간
                var nowTime = now.getFullYear() + "년" + (now.getMonth()+1) + "월" + now.getDate() + "일" + now.getHours() + "시" + now.getMinutes() + "분";
                TheForm.date.value = nowTime;
                TheForm.nextTarget.value = 'communityBoardList';
                TheForm.action = './communityBoardDelete.do';
                TheForm.submit();
            }

        }

        // 글보기 페이지로 이동
        function jsContentView() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'communityBoardContent';
            TheForm.action = './communityBoardContent.do';
            TheForm.submit();
        }

        // Community Board List 페이지로 이동한다.
        function jsCommunityBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "communityBoardList";	// page name
            TheForm.action = "./communityBoardList.do";
            TheForm.submit();
        }

        // Photo Board List 페이지로 이동한다.
        function jsPhotoBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "photoBoardList";	// page name
            TheForm.action = "./photoBoardList.do";
            TheForm.submit();
        }

        // Notice Board List 페이지로 이동한다.
        function jsNoticeBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "noticeBoardList";	// page name
            TheForm.action = "./noticeBoardList.do";
            TheForm.submit();
        }

        // Contact Us 페이지로 이동한다.
        function jsContactUs() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "contactus";	// page name
            TheForm.action = "./contactus.do";
            TheForm.submit();
        }

        // FAQ 페이지로 이동한다.
        function jsFAQ() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "faq";	// page name
            TheForm.action = "./faq.do";
            TheForm.submit();
        }

        // Board List 출력
        function jsBoardList() {
            var TheForm = document.writeFrm;
            TheForm.nextTarget.value = "admin";	// page name
            TheForm.action = "./admin.do";
            TheForm.submit();
        }


        function jsContactChange(cYN) {
            var TheForm = document.frm;

            if(cYN == "Y"){
                <!-- 완료된 문의 목록에서 왔을 경우 상태를 변경 하고 다시 완료된 문의 목록으로 돌아감 -->
                TheForm.complete_yn.value = cYN;
                TheForm.nextTarget.value = "redirect:./adminComplete.do";
                TheForm.action = "./contactChange.do";
                TheForm.submit();
            }else{
                <!--  미완료된 문의 목록에서 왔을 경우 상태를 변경 하고 다시 미완료된 문의 목록으로 돌아감 -->
                TheForm.complete_yn.value = cYN;
                TheForm.nextTarget.value = "redirect:./admin.do";
                TheForm.action = "./contactChange.do";
                TheForm.submit();
            }
        }

    </script>
</head>

<body>
<div id="wrapper">
    <!------------------------------ top 시작-------------------------------------->
    <%@include file="header.jsp" %>
    <!------------------------------ top 끝-------------------------------------->
    <div class="mypage_content">
        <form name="frm" method="POST">
            <input type="hidden" name="contact_no" value="${contact.contact_no}">
            <input type="hidden" name="complete_yn" value="${contact.complete_yn}">
            <input type="hidden" name="nextTarget" value="">

            <img src="/images/intro/sub_title08.gif"  />
            <a href="admin.do"><input name="Input" class="admin_button_on" value="<spring:message code="adminContact.topButton1" />" /></a>
            <a href="adminMemberList.do?id&nick_name&email"><input name="Input" class="admin_button_off" value="<spring:message code="adminContact.topButton2" />" /></a>
            <a href="adminStatistic.do"><input name="Input" class="admin_button_off" value="<spring:message code="adminContact.topButton3" />" /></a>
            <p class="admin_subtitle">
                <c:if test="${flag == 0}">
                    <spring:message code="adminContact.subtitle1" />
                </c:if>

                <c:if test="${flag == 1}">
                    <spring:message code="adminContact.subtitle2" />
                </c:if>
            </p>
            <table class="mypage_tb">
                <tr>
                    <td class="admin_no">${contact.contact_no}</td>
                    <td class="admin_label"><spring:message code="admin.${contact.category}" /></td>
                    <td colspan="3" class="admin_label">${contact.writer_id}(${contact.writer_nick_name})</td>
                    <td class="admin_label">${contact.writer_email}</td>
                    <td class="admin_lastlabel">${contact.register_date}</td>
                </tr>
                <tr>
                    <td colspan="7" class="admin_content">
                        ${contact.content}
                    </td>
                </tr>
                <c:set value="Y" var="addFile"/>
                <%-- 이전 업로드했던 이미지가 있을 경우.--%>
                <c:if test="${contact.add_file_yn == addFile}">
                    <tr>
                        <td id="org_img_show"  colspan="7" class="admin_download">
                                <%-- 해당 이미지의 원본 이름을 보여주고 클릭시 다운로드 하도록 한다.--%>
                                <%-- 문의사항용 파일은 /upload/contact/ 폴더 안에 저장되기 때문에 contact/ 디렉토리를 추가로 파라미터에 추가해준다 --%>
                            <spring:message code="adminContact.download" /> <a href="/download.do?tFileName=contact/${contact.add_file_temp_name}&oFileName=${contact.add_file_original_name}">${contact.add_file_original_name}</a>&nbsp;&nbsp;${contact.add_file_size}&nbsp;byte
                        </td>
                    </tr>
                </c:if>
            </table>
            <!---------------------------------------- 버튼 -------------------------------------->
            <div class="btn_right02">
                <!-- 미완료 목록으로 돌아가기 -->
                <a href="javascript:jsContactChange('${contact.complete_yn}')"><img src="/images/intro/btn_change.gif" /></a>

            </div>
            <div class="btn_left">
                <!-- 미완료 목록으로 돌아가기 -->
                <c:if test="${flag == 0}">
                    <a href="admin.do"><img src="/images/intro/btn_list.gif" /></a>
                </c:if>

                <!-- 완료 목록으로 돌아가기 -->
                <c:if test="${flag == 1}">
                    <a href="adminComplete.do"><img src="/images/intro/btn_list.gif" /></a>
                </c:if>
            </div>
        </form>
    </div>
    <!------------------------------ 하위메뉴 시작-------------------------------------->
    <%@include file="footer.jsp" %>
    <!------------------------------ 하위메뉴 끝-------------------------------------->
</div>
</body>
</html>